package com.qf.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.pojo.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 角色Dao
 * @author 千锋健哥
 */
public interface RoleDao extends BaseMapper<Role> {

    /**
     * 根据用户id获取角色集合
     * @param userId
     * @return
     */
    @Select("select c.*  " +
            "from sys_user a  " +
            "left join sys_user_role b on a.id = b.user_id " +
            "left join sys_role c on c.id = b.role_id " +
            "where a.id=#{userId}")
    public List<Role> findRoleByUserId(@Param("userId") Long userId);
}
